home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 7
/
Aminet 7 - August 1995.iso
/
Aminet
/
comm
/
mebbs
/
war.lha
/
WAR
/
WAR.REXX
< prev
Wrap
OS/2 REXX Batch file
|
1994-05-30
|
9KB
|
327 lines
/* Original By J.L. White */
/* re-written and improved by */
/* Robert Lehman of Southwinds bbs for mebbsnet >1.5x */
/* May 29th 1994, (219) 289-3275 Vfast 28.8 Maxnet International 90:91/0 */
/* Mebbs developers #M3005 */
SIGNAL ON ERROR
SIGNAL ON SYNTAX
SIGNAL ON IOERR
SIGNAL ON FAILURE
parse arg LineNumber
OPTIONS RESULTS
DoorName = "War"
if( ~show( 'l', "mebbsarexx.library" ) )then do
if( ~addlib( "mebbsarexx.library", 0, -30, 0 ) )then do
say "Could not open library"
exit 10
end
end
author = 'Robert Lehman'
version = 'Version 2.0'
call getvar doorname,linenumber, 8
gfx = result
if gfx = 1 then do
CLS = 'H'
HOM = ''
BGD = '
'
RED = '
'
YLW = '
'
GRN = '
'
CYN = '
'
MAG = '
'
BLU = '
'
GCN = '
'
RES = ''
end
else do
CLS = 'H'
HOM = ''
BGD = ''
RED = ''
YLW = ''
GRN = ''
CYN = ''
MAG = ''
BLU = ''
GCN = ''
RES = ''
end
call getvar doorname,linenumber, 1
UserName = result
call Instructions
Main:
UserScore = 26
MYScore = 26
call Intro
call Slap
return
Slap:
do forever
call message doorname,linenumber, ' ',1
Call prompt doorname,linenumber, CYN'Press [RETURN] To Continue Or [Q] To Quit'GRN'...>',2
YesPlay = upper(result)
if YesPlay = 'Q' then call Totals
call checkca
call message doorname,linenumber, CLS,1
call Deal
end
return
GetColor:
ColorSet = RANDOM(1,2,Time('s'))
if ColorSet = 1 then Color = '
'
else Color = '
'
return
Card:
Num = RandBoth
if RandBoth = 1 then Num = 'A'
if RandBoth = 11 then Num = 'J'
if RandBoth = 12 then Num = 'Q'
if RandBoth = 13 then Num = 'K'
if RandBoth = 10 then call Print2
else call Print1
return
Print1:
call message doorname,linenumber, CardPos' 'Color''Num' ',1
call message doorname,linenumber, CardPos' 'Color' * 'Whos' Card',1
call message doorname,linenumber, CardPos' 'Color' 'Num'',1
return
Print2:
call message doorname,linenumber, CardPos' 'Color'10 ',1
call message doorname,linenumber, CardPos' 'Color' * 'Whos' Card',1
call message doorname,linenumber, CardPos' 'Color' 10',1
return
Pick:
Rand1 = RANDOM(1,13,Time('s'))
RandBoth = Rand1
call GetColor
CardPos = ' '
Whos = 'Your'
call Card
Rand2 = RANDOM(1,13,Time('s'))
RandBoth = Rand2
call GetColor
CardPos = ' '
Whos = 'MY'
call message doorname,linenumber, ' ',1
call Card
if Rand1 = 1 then Rand1 = 14
if Rand2 = 1 then Rand2 = 14
return
Deal:
call Pick
CardNum = 1
call MoreOrLess
CardNum = 1
call HowMany
return
HowMany:
if Rand1 = Rand2 then do
call message doorname,linenumber, ' ',1
call message doorname,linenumber, 'Its
WAR
!!!',1
do x = 1 to 300
end
call PickIt
call PickIt
call PickIt
CardNum = CardNum + 3
if Rand1 = Rand2 then call HowMany
else call MoreOrLess
end
return
PickIt:
call message doorname,linenumber, CLS,1
call Pick
do x = 1 to 100
end
return
MoreOrLess:
call message doorname,linenumber, ' ',1
if Rand1 > Rand2 then do
call message doorname,linenumber, CYN'You Win'GRN'!',1
UserScore = UserScore + CardNum
MYScore = MYScore - CardNum
if MYScore <= 0 | UserScore >= 52 then call Done
end
if Rand1 < Rand2 then do
call message doorname,linenumber, CYN'You Lose'GRN'!',1
UserScore = UserScore - CardNum
MYScore = MYScore + CardNum
if UserScore <= 0 | MYScore >= 52 then call Done
end
call message doorname,linenumber, ' ',1
call message doorname,linenumber, CYN'Your Score'GRN':'CYN UserScore GRN'|'CYN' MY Score'GRN':'CYN MYScore,1
return
Done:
call message doorname,linenumber, 'Thats the game! No more cards left...',1
if UserScore <= 0 then UserScore = 0
if MYScore <= 0 then MYScore = 0
if UserScore >= 52 then UserScore = 52
if MYScore >= 52 then MYScore = 52
call Totals
return
Totals:
call message doorname,linenumber, ' ',1
if UserScore > MYScore then do
Bonus = UserScore - MYScore
call message doorname,linenumber, 'You Have 'Bonus % 2' More Cards Than When You Started.',1
call message doorname,linenumber, ' ',1
Bonus = Bonus % 4
if MYScore = 0 then Bonus = 30
if Bonus = 0 then Bonus = 1
if Bonus = 1 then call message doorname,linenumber, YLW'You Win ',1
else call message doorname,linenumber, 'You Win ',1
end
if UserScore < MYScore then do
Bonus = MYScore - UserScore
call message doorname,linenumber, 'You Have 'Bonus % 2' Cards Less Than When You Started.',1
Bonus = Bonus % 4
if UserScore = 0 then Bonus = 15
if Bonus = 0 then Bonus = 1
if Bonus = 1 then call message doorname,linenumber, YLW'You Lose ',1
else call message doorname,linenumber, YLW'You Lose ',1
Bonus = -Bonus
end
call message doorname,linenumber, ' ',1
call Again
call Finished
return
Again:
call message doorname,linenumber, ' ',1
Call prompt doorname,linenumber, CYN'Do You Want To Play Again 'GRN'('CYN'Y'GRN'/'CYN'N'GRN')'CYN'?',2
PlayAgain = upper(result)
if PlayAgain = 'Y' then call Main
if PlayAgain = 'N' then call Finished
call checkca
return
Finished:
call message doorname,linenumber, ' ',1
call message doorname,linenumber, 'Hope You Enjoyed The Game',1
signal wrap_up
Instructions:
call message doorname,linenumber, CLS,1
call message doorname,linenumber, ' ',1
Call prompt doorname,linenumber, CYN' Do You Need Instructions 'GRN'('CYN'Y'GRN'/'CYN'N'GRN')'CYN'? ',2
answer = upper(result)
if answer = 'Y' then do
call checkca
call message doorname,linenumber, CLS,1
call message doorname,linenumber, ' The object of WAR is to win all the cards in the deck. You start the game',1
call message doorname,linenumber, 'with half the deck. You & the computer take turns placing one card down at a',1
call message doorname,linenumber, 'time. Whoever has the highest card wins both cards. If both of your cards',1
call message doorname,linenumber, 'have the same value, you go to WAR. This means you take 3 cards and place',1
call message doorname,linenumber, 'them down, the last card is the one to beat. Whoever wins at War will get 3',1
call message doorname,linenumber, 'cards plus the original one. If you match again in War, you continue to add',1
call message doorname,linenumber, '3 cards each time. This can really build up your stack.' ,1
call message doorname,linenumber, 'Whoever has all 52 cards is the winner!!!' ,1
call message doorname,linenumber, ' You can quit anytime during the game.',1
call message doorname,linenumber, 'Well That about does it. Enjoy...',1
call message doorname,linenumber, ' ',1
call hotkey doorname,linenumber, 'Press [RETURN] To Continue...'
call checkca
end
return
Intro:
call message doorname,linenumber, CLS,1
call message doorname,linenumber, GRN'@ @ @@ @@@'CYN' 'version,1
call message doorname,linenumber, YLW'@ @ @ @ @ @ ',1
call message doorname,linenumber, GRN'@ @ @ @@@@ @@@'CYN' Written By 'author,1
call message doorname,linenumber, YLW'@@ @@ @ @ @ @ ',1
call message doorname,linenumber, GRN'@ @ @ @ @ @'CYN' ',1
call Delay
call message doorname,linenumber, CYN'One Moment While I Shuffle The Deck'GRN'...',1
call Delay
call message doorname,linenumber, CYN'OK, Now I Will Deal The Cards Out'GRN'...',1
call Delay
call message doorname,linenumber, CYN'We Are Ready To Begin!',1
call Delay
return
Delay:
call message doorname,linenumber, ' ',1
do x = 1 to 300
end
return
/* error and exit routines */
Wrap_up:
call exit_door DoorName,LineNumber
exit 0
CHECKCA:
call cdetect doorname,linenumber
carrier = result
if carrier = 'no carrier!' then do
signal getout
end
return
IOERR:
call message doorname,linenumber,'',1
Call message doorname,linenumber, '**ALERT** input output error!',1
err_line = SIGL ; sev = RC
Call message doorname,linenumber, 'Line: 'err_line' Severity: 'sev,1
call hotkey doorname,linenumber,'Press return...'
call exit_door DoorName,LineNumber
exit 10
ERROR:
call message doorname,linenumber,'',1
Call message doorname,linenumber, '**ALERT** General Error!',1
err_line = SIGL ; sev = RC
Call message doorname,linenumber, 'Line: 'err_line' Severity: 'sev,1
call hotkey doorname,linenumber,'Press return...'
call exit_door DoorName,LineNumber
exit 10
SYNTAX:
Call message doorname,linenumber, '**ALERT** Syntax Error!',1
err_line = SIGL ; sev = RC
Call message doorname,linenumber, 'Line: 'err_line' Severity: 'sev,1
call hotkey doorname,linenumber,'Press return...'
call exit_door DoorName,LineNumber
exit 10
FAILURE:
Call message doorname,linenumber, '**ALERT** Failure!',1
err_line = SIGL ; sev = RC
Call message doorname,linenumber, 'Line: 'err_line' Severity: 'sev,1
call hotkey doorname,linenumber,'Press return...'
call exit_door DoorName,LineNumber
exit 10